<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" pageEncoding="utf8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>" type="text/css" />
		<link rel="stylesheet" href="<c:url value='/scripts/themes/base/jquery.ui.all.css'/>" type="text/css" />
	</head>
	<body>
		<div class="head_content" id="headBar"></div>
		<div class="main_content" id="main">
			<form method="post" action="gd_type_save.html" id="edit_type_form">
				<input type="hidden" value="${goodsType.typeId }" name="goodsType.typeId" />
				<div style="padding: 20px;">
					<div class="division">
						<table width="100%">
							<tbody>
								<tr>
									<th>
										是否为实体商品
									</th>
									<td>
										<label>
											<input type="radio" <c:if test="${ goodsType.physicalOn}">checked="checked"</c:if> name="goodsType.physicalOn" value="true" />
											<fmt:message key="common_true" />
										</label>
										&nbsp; &nbsp;
										<label>
											<input <c:if test="${ !goodsType.physicalOn}">checked="checked"</c:if> type="radio" name="goodsType.physicalOn" value="false" />
											<fmt:message key="common_false" />
										</label>
									</td>
								</tr>
								<tr>
									<th>
										是否与品牌关联
									</th>
									<td>
										<label>
											<input type="radio" <c:if test="${goodsType.brandUsed}">checked="checked"</c:if> onclick=" showTypeBrand(true)" name="goodsType.brandUsed" value="true" />
											<fmt:message key="common_true" />
										</label>
										&nbsp; &nbsp;
										<label>
											<input type="radio" onclick=" showTypeBrand(false)" <c:if test="${ !goodsType.brandUsed}">checked="checked"</c:if> name="goodsType.brandUsed" value="false" />
											<fmt:message key="common_false" />
										</label>
										<span class="notice_inline">注意：如果不关联品牌，在前台商品列表页该类型商品将无法使用品牌进行筛选</span>
									</td>
								</tr>
								<tr>
									<th>
										是否启用商品扩展属性
									</th>
									<td>
										<label>
											<input type="radio" onclick=" showTypeAttr(true)" <c:if test="${ goodsType.attributeUsed}">checked="checked"</c:if> name="goodsType.attributeUsed" value="true" />
											<fmt:message key="common_true" />
										</label>
										&nbsp; &nbsp;
										<label>
											<input type="radio" onclick=" showTypeAttr(false)" <c:if test="${ !goodsType.attributeUsed}">checked="checked"</c:if> name="goodsType.attributeUsed" value="false" />
											<fmt:message key="common_false" />
										</label>
									</td>
								</tr>
								<tr>
									<th>
										是否启用商品参数表
									</th>
									<td>
										<label>
											<input type="radio" onclick=" showTypePara(true)" <c:if test="${ goodsType.parameterUsed}">checked="checked"</c:if> name="goodsType.parameterUsed" value="true" />
											<fmt:message key="common_true" />
										</label> &nbsp; &nbsp;
										<label>
											<input type="radio" onclick=" showTypePara(false)" <c:if test="${ !goodsType.parameterUsed}">checked="checked"</c:if> name="goodsType.parameterUsed" value="false" />
											<fmt:message key="common_false" />
										</label> 
									</td>
								</tr>
							</tbody>
						</table>
					</div>

					<div   style="padding: 10px 0;">
						<h4>
							基本设置
						</h4>
						<div style="padding: 3px; margin: 0pt;" class="division">
							<table>
								<tbody>
									<tr>
										<th align="right">
											类型名称:
										</th>
										<td>
											<input type="text" value="${goodsType.name}" name="goodsType.name" class="_x_ipt" />
										</td>
									</tr>
									<tr id="type_brands">
										<th align="right">
											关联品牌:
										</th>
										<td>
											<c:forEach var="tb" items="${goodsTypeBrands}" varStatus="brandIndex">
												<input type="hidden" value="${tb.tbId }" name="goodsTypeBrands[${brandIndex.index}].tbId" />
												<input type="hidden" value="${goodsType.typeId }" name="goodsTypeBrands[${brandIndex.index}].typeId" />
												<input <c:if test="${not empty  tb.tbId }"> checked="checked" </c:if> type="checkbox" value="${tb.brandId }" name="goodsTypeBrands[${brandIndex.index}].brandId" />${tb.brandName }
											</c:forEach>

										</td>

									</tr>
								</tbody>
							</table>
						</div>
					</div>


					<div id="" style="padding: 1px 0;">
						<h4>
							规格
						</h4>
						<div id="form_style_spec" style="padding: 3px; margin: 0pt;" class="division">
							<span class="sysiconBtn add addSpec" id='addSpec-btn'>新增规格</span>
							<div class="row gridlist-head" id="form_style_spec_header">
								<div style="text-align: center;" class="p_name span-3">
									规格
								</div>
								<div style="text-align: center;" class="p_type span-5">
									商品列表页显示方式
								</div>
								<div style="text-align: center;" class="p_optionalias span-5">
									操作
								</div>
							</div>
							<div style="height: 300px; overflow: auto; border: 1px solid rgb(239, 239, 239); margin-bottom: 10px;" class="gridlist" id="spec_box">
								<c:forEach var="list" items="${goodsTypeSpecs}" varStatus="listIndex">
									<div class="row">
										<div class="p_name span-3" style="text-align: center;">
											${list.specName }
											<input type="hidden" name="goodsTypeSpecs[${listIndex.index}].tsrId" value="${list.tsrId }" />
											<input type="hidden" name="goodsTypeSpecs[${listIndex.index}].typeId" value="${goodsType.typeId}" />
											<input type="hidden" name="goodsTypeSpecs[${listIndex.index}].specId" value="${list.specId }" />
										</div>
										<div class="p_type span-5" style="text-align: center;">
											<select name="goodsTypeSpecs[${listIndex.index}].specStyle">
												<option value="1" <c:if test="${list.specStyle==1}">checked="checked"</c:if>>
													可筛选-平铺显示
												</option>
												<option value="2" <c:if test="${list.specStyle==2}">checked="checked"</c:if>>
													可筛选-下拉显示
												</option>
												<option value="3" <c:if test="${list.specStyle==3}">checked="checked"</c:if>>
													不作为筛选项
												</option>
											</select>
										</div>
										<div class="p_optionalias span-5" style="text-align: center;">
											<img style="cursor: pointer;" onclick="delTypeSpec(this,${list.tsrId})" src="<c:url value="/images/statics/icons/icon_delete.gif"/>" class="operater" />
										</div>
										<div style="clear: both;"></div>
									</div>
								</c:forEach>
							</div>
						</div>
					</div>

					<div id="type_attribute" style="padding: 10px 0;">
						<h4>
							扩展属性
						</h4>
						<div style="padding: 3px; margin: 0pt;" class="division">
							<div style="padding: 3px;" class="action-bar">
								<span class="sysiconBtn addorder" onclick="addProps()">添加一个扩展属性</span><span class="notice-inline">输入项最多能够添加8个，选择项最多能添加20个</span>
							</div>
							<div class="gridlist-head">
								<div style="text-align: center;" class="p_name span-6">
									属性名
								</div>
								<div style="text-align: center;" class="p_type span-5">
									前台列表页表现类型
									<span id=""> <img src="<c:url value="/images/tips_info.gif"/>" /> </span>
								</div>
								<div style="text-align: center;" class="p_optionalias span-10">
									选择项可选值
									<span id=""> <img src="<c:url value="/images/tips_info.gif"/>" /> </span>
								</div>
								<div style="text-align: center;" class="p_optionalias span-5">
									排序
									<span id=""> <img src="<c:url value="/images/tips_info.gif"/>" /> </span>
								</div>
								<div style="text-align: center;" class="p_optionalias span-1">
									刪除
								</div>
							</div>
							<div style="height: 300px; overflow: auto; border: 1px solid rgb(239, 239, 239); margin-bottom: 10px;" class="gridlist" id="props_box">

								<c:forEach var="list" items="${goodsTypeAttributes}" varStatus="vs">
									<div class="row">
										<div class="p_name span-6">
											<input name="goodsTypeAttributes[${vs.index }].taId" value="${list.taId }" type="hidden" />
											<input name="goodsTypeAttributes[${vs.index }].searchable" value="${list.searchable }" type="hidden" />
											<input name="goodsTypeAttributes[${vs.index }].name" value="${list.name }" />
											<input name="goodsTypeAttributes[${vs.index }].typeId" type="hidden" value="${list.typeId}" size="12" />
										</div>
										<div class="p_type span-5">
											<select onchange="changePropsType(this)" name="goodsTypeAttributes[${vs.index }].attributeType">
												<optgroup label="选择项">
													<option value="3" <c:if test="${list.attributeType==3}">selected="selected"</c:if>>
														选择项 - 渐进式筛选
													</option>
													<option value="4" <c:if test="${list.attributeType==4}">selected="selected"</c:if>>
														选择项 - 下拉筛选
													</option>
													<option value="5" <c:if test="${list.attributeType==5}">selected="selected"</c:if>>
														选择项 - 不可筛选
													</option>
												</optgroup>
<!--												<optgroup label="输入项">-->
<!--													<option value="1" <c:if test="${list.attributeType==1}">selected="selected"</c:if>>-->
<!--														输入项 - 可搜索-->
<!--													</option>-->
<!--													<option value="2" <c:if test="${list.attributeType==2}">selected="selected"</c:if>>-->
<!--														输入项 - 不可搜索-->
<!--													</option>-->
<!--												</optgroup>-->
											</select>
										</div>
										<div class="p_optionalias span-10">
											<input name="goodsTypeAttributes[${vs.index }].options" value="${list.options }" style="width: 85%;" />
										</div>
										<div class="p_optionalias span-5">
											<input type="text" name="goodsTypeAttributes[${vs.index }].showOrder" value="${list.showOrder }" style="width: 50%;" class="x-input " />
										</div>
										<div onclick="delProps(this,${list.taId })" style="text-align: center; color: red; cursor: pointer;" class="p_btn span-1">
											<img style="width: 16px; height: 16px; background-position: 0pt -214px;" class="imgbundle" src="<c:url value="/images/transparent.gif"/>" alt="删除" title="删除" />
										</div>
										<div style="clear: both;"></div>
									</div>
								</c:forEach>

							</div>
						</div>
					</div>



					<div id="type_parameter" style="padding: 20px 0;">
						<h4>
							参数组
						</h4>
						<div style="padding: 3px; margin: 0pt;" class="tableform">
							<div class="sysiconBtn addorder" onclick='addParaGroup()'>
								添加一个参数组
							</div>
							<div style="height: 400px; overflow: auto;" id="params_box">
								<c:forEach var="list" items="${gdTypeParameters}" varStatus="vs">
									<div style="border: 1px solid rgb(199, 219, 229); margin: 0pt 0pt 5px;" class="tableform">
										参数组名称:
										<input id="params_${vs.index }" value='${list.name }' name="gdTypeParameters[${vs.index }].name" />
										<span class="sysiconBtn addorde" onclick='addParaItem(${vs.index })'>为这个参数组添加一个参数</span><span onclick='delParaGroup(this)' class="sysiconBtn delete">删除此参数组</span>
										<div class="division">
											<ul id="params_item_${vs.index }">
												<c:forEach var="childList" items="${list.child}" varStatus="childIndex">
													<li>
														参数名：
														<input value="${childList.name }" size="15" name="gdTypeParameters[${vs.index }].child[${childIndex.index}].name" />
														<span onclick="delParaItem(this)"><img style="width: 16px; height: 16px; background-position: 0pt -214px;" class="imgbundle" src="<c:url value="/images/transparent.gif"/>" />
														</span>
													</li>
												</c:forEach>
											</ul>
										</div>
									</div>
								</c:forEach>
							</div>
						</div>

					</div>

					<div class="table-action">
						<button class="btn" type="submit">
							<span><span><fmt:message key="button.save" /></span> </span>
						</button>
					</div>



				</div>
			</form>
		</div>
		<div class="foot_content" id="footBar"></div>

		<%@ include file="typeFormMore.jsp"%>
	</body>
</html>